import moment from 'moment';
import { DatePicker } from 'antd';

const { RangePicker } = DatePicker;
class DateRange extends React.PureComponent {
    constructor(props) {
        super(props)
    }
    render() {
        const { rangePickerChange, dateFormat, startTime, endTime } = this.props;
        const dateRange = [moment(startTime, dateFormat), moment(endTime, dateFormat)];
        return <div style={{ width: '450px', marginBottom: '20px', display: 'inline-block', marginRight: '20px' }}>
            <div style={{ flex: '1' }}>
                <span style={{ fontWeight: 'bold', width: '45px' }}>执行时间：</span><RangePicker
                    format={dateFormat}
                    defaultValue={dateRange}
                    showTime
                    style={{ width: '330px' }}
                    value={dateRange}
                    onChange={rangePickerChange}
                    placeholder={['开始时间', '结束时间']}
                />
            </div>
        </div>
    }
}
export default DateRange;